using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Vin.Tool.AspNetCore.Singleton;

namespace Vin.Tool.AspNetCore.Service;

public abstract class VinBackgroundService : BackgroundService
{
    protected ILogger Logger =>
        VinApp.GetRequiredService<ILoggerFactory>().CreateLogger(this.GetType());

    protected virtual string LoggerName => this.GetType().Name;

    public VinBackgroundService()
    {
        VinApp.Inject(this);
    }
}